<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .box {
            width: 300px;
            height: 300px;
        }
    </style>
</head>

<body>

    <button onclick="changeImg(1)">换图1</button>
    <button onclick="changeImg(2)">换图2</button>
    <div class="box">
        <img src="./img/fj1.jpg" alt="">
    </div>

    <script>
        function changeImg(num) {
            // 修改img的src属性
            document.querySelector('img').src = `./img/fj${num}.jpg`;
        }
    </script>
</body>

</html>